/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.fpt.c0810g.newspj.dataaccess;

import com.aptech.fpt.c0810g.newspj.dataaccess.share.InvokeSelectQuery;
import com.aptech.fpt.c0810g.newspj.entity.Catalogy;
import java.util.ArrayList;
import java.util.HashMap;

/**
 *
 * @author zang
 */
public class CatalogyAction {

    /***
     * @author AnhGT
     * @return Danh sach catalogy
     */
    public ArrayList<Catalogy> getCatalogyList() {
        ArrayList<Catalogy> list = new ArrayList<Catalogy>();
        //Cac cot muon truy van
        ArrayList<String> colums = new ArrayList<String>();
        colums.add("ID");
        colums.add("Name");
        //Cac dieu dien 
        ArrayList<String> codition = new ArrayList<String>();
        //Bang muon truy van
        String tableName = "Catalogy";
        ArrayList<HashMap<String,Object>> records = new InvokeSelectQuery().getList(colums, tableName, codition);
        //add gia tri
        for (int i = 0; i < records.size(); i++) {
            Catalogy cate = new Catalogy();
            cate.setId(Integer.valueOf(records.get(i).get("ID").toString()));
            cate.setName(records.get(i).get("Name").toString());
            list.add(cate);
        }
        return list;
    }
}
